
import gevent
import time

def sing(name):
   for i in range(3):
       gevent.sleep(1)
       print(f"{name} is singing, it's time {i}")


if __name__ == "__main__":
    gevent.joinall([
        gevent.spawn(sing, "leslie"),
        gevent.spawn(sing, "moon")
    ])

    print("Perfect show.")

# joinall: 等待所有的协程都执行结束再退出
# joinall: 等待所有的协程都执行结束再退出
